import '../style/home.css'

import React from 'react'
import ReactDOM from 'react-dom'
import Root from './Root.jsx'
import configureStore from './store/configureStore'
import context from './context.js'
import { fullWidthLayout, halfWidthLayout, customerLayout } from './common/autoLayout.js'

const store = configureStore({app: {width: document.body.clientWidth},login: {}})

window.addEventListener('orientationchange', function (event) {
  let state = store.getState()
  if (window.orientation == 180 || window.orientation == 0) {
    state.app.col = 1
    alert('竖屏')
    render() // alert("竖屏")
  }
  if (window.orientation == 90 || window.orientation == -90) {
    state.app.col = 2
    alert('横屏')
    render() // alert("横屏")
  }
})

const render = () => {
  ReactDOM.render(
    <Root store={store} />,
    document.querySelector('#wrapper')
  )
}

store.subscribe(render)
render()
